<template>
	<view style="padding: 30rpx;">
		<view style="background-color: #fff;border-radius: 16rpx;">
			<u-cell-item :arrow="false" hover-class="none" icon="account-fill" title="账户信息" :value="userInfo.username"></u-cell-item>
			<u-cell-item icon="eye-fill" title="修改密码" @click="toUpdatePassword()"></u-cell-item>
		</view>
		<view style="margin-top: 50rpx;">
			<u-button type="error" @click="logout()">退出登录</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: ''
			}
		},
		onLoad() {
			this.getInfo()
		},
		methods: {
			getInfo() {
				this.$u.get("/mini/user/info").then(res => {
					if (res.success) {
						this.userInfo = res.data
					}
				})
			},
			logout() {
				uni.removeStorageSync("username")
				uni.removeStorageSync("password")
				uni.reLaunch({
					url: "/pages/login/login"
				})
			},
			toUpdatePassword(){
				uni.navigateTo({
					url:"/pages/mine/updatePassword/updatePassword"
				})
			}
		}
	}
</script>

<style>

</style>